#include "Arduino.h"

// inslude the SPI library:
#include <Flash.h>
#include <SPI.h>
#include <Serial.h>
#include <avr/interrupt.h>
#include <EEPROM.h>

#define AMOUNT 1000

Flash* nandFlash;

void setup() 
{
  nandFlash = new Flash();
  Serial.begin(19200);
}

unsigned long timeWrite(int amount)
{    
  nandFlash->programLoadStart(0, 0);
  for (int i = 0; i < amount; i++)
  {
    nandFlash->programLoad((byte)i);
  }
  nandFlash->programLoadEnd();
    
  Serial.println("Writing to main array");
   
  nandFlash->programExecute(0x536); 
  unsigned long startTime = micros();
  while (!nandFlash->changeState(STATE_NONE));
  unsigned long endTime = micros();
  
  return endTime - startTime;
}

void loop() 
{  
  
  
  Serial.println("**************************************** DONE **********************************");
}

